<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
//
if(!$_COOKIE['userid']){
      echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
      exit;
}

?>





<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>待收货-众晒网</title>
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
    <style type="text/css">
    .H-theme-background-color9 {
    background-color: #ffffff;
}
.H-theme-font-color-white {
    color: black;
}
.H-theme-border-color9 {
    border: 1px solid #ffa200;
}
.H-theme-font-color9 {
    color: #ffa200;
}
    button {
    background: #cccccc00;
    border-radius: 7px;
    border: 1px solid #828282;
    margin: 11px;
    font-size: 12px;
    width: 65px;
}
:focus {
    border-color: #ffa200;
    border-radius: 5px;
    outline: none;
    color:  #ffa200;
}
.H-theme-border-color9 {
    border: 0;
    border-bottom: 2px solid;
}
    </style>
</head>
<body id="body">
    <header class="H-header H-theme-background-color9" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-font-size-18 H-vertical-middle"></i><label class="H-display-block H-vertical-middle H-font-size-15">返回</label></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-white H-position-absolute H-width-100-percent">
            我的订单
        </div>
        <div class="H-flexbox-horizontal H-theme-background-color-white" id="tag">
            <div tapmode="" onclick="H.openWin('all', 'all.php');" class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
                全部
            </div>
            <div tapmode="" onclick="H.openWin('obligations', 'obligations.php');"  class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
                待付款
            </div>
            <div tapmode="" onclick="H.openWin('receipt', 'receipt.php');"  class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16 H-theme-border-color-52ace5 H-theme-font-color-52ace5 H-theme-border-color9 H-theme-font-color9" style="border-width: 0 0 2px  0">
                待收货
            </div>
            <div tapmode="" onclick="H.openWin('evaluated', 'evaluated.php');" class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
                待评价
            </div>
        </div>
    </header>
    <div id="lis" class="H-padding-8">
	
	  <?php

  	$reslut = "select count(*) as a from tbl_taorder where is_deliv<2 and is_pay=1  and uid='".$_COOKIE['userid']."'";
  $query_reslut = mysql_query($reslut);
$row_reslut=mysql_fetch_array($query_reslut);
$count=$row_reslut['a'];
//页面数量
$page_size=3;
//总页数
$page_count = ceil($count/$page_size);
//第几页
$page=$_GET['page'];
if($page==''){
  $page=1;
}
$last=$page-1;//上一页
$next=$page+1;//下一页

//页面起始条数
$offset=$page_size*($page-1);
  
  
  
           $sql1 = "select * from tbl_taorder where  is_deliv<2 and is_pay=1 and uid='".$_COOKIE['userid']."' order by id desc LIMIT $offset,$page_size";
           $query1 = mysql_query($sql1);
		
        if(!mysql_affected_rows()){
            echo '
                <div class="H-padding-vertical-bottom-10"></div>
                </br>
    <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
        <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
        <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">暂无</div>
    </div>
    </br></br>
            ';
}        
        while ($row=mysql_fetch_array($query1)) {
            
    ?> 
	
	
		     <?php
       $sql3 = "select * from tbl_taospp  where id='".$row['goodid']."'";
        $query3=mysql_query($sql3);
		$row3=mysql_fetch_array($query3);
					 				if($row['bunit']<1){
	               $a=explode(',', $row3['img']);			
				} else
				{
					
			$sqlimg="SELECT * FROM tbl_goods_sku WHERE id= '".$row['bunit']."'";
			$rowimg= mysql_query($sqlimg);
			$rowall=mysql_fetch_array($rowimg);
			$a =explode(",", $rowall['sku_pic']);
			

			
	
				
				}
		 
		 
		 
		 
		 
		 
		 ?>
	
	
        <div id="list1" class="H-border-radius3-px H-theme-background-color-white H-margin-vertical-bottom-5 H-border-vertical-both-after H-border-horizontal-both-after">
            
			<div onclick="H.openWin('paycontentao', 'paycontentao.php?fid=<?php echo $row['orderid'] ?>');"   class="H-padding-10 H-border-vertical-bottom-after H-flexbox-horizontal H-theme-font-color-999 H-font-size-14 H-flexbox-horizontal H-text-horizontal-left H-box-sizing-border-box">
            	<span class="H-font-size-10">订单号：<?=$row['orderid']?></span><span class="H-font-size-10 H-display-block H-flex-item H-text-align-right"><?php echo date("Y-m-d",$row['addtime'])  ?></span>
            </div>
			
			
            <div class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after">
                <div class="H-padding-vertical-both-10">
                    <img src="<?php echo $a[0] ?>" srcs="" alt="" title="" class="imgCache H-display-block H-margin-horizontal-left-10" style="width: 60px; height: 60px;" />
                </div>
                <div class="H-flex-item H-padding-10">
                    <strong class="H-font-weight-normal font-weight-500 H-font-size-16 H-display-block H-text-show-row-1"><?php echo $row3['chtitle'] ?></strong>
                    <div class="H-font-size-12 H-theme-font-color-999 H-text-show-row-1">
                        ￥<?php echo $row['totprice'] ?>
                    </div>
                    <div class="H-font-size-12 H-theme-font-color-999 H-text-show-row-2">
                        数量：<?php echo $row['gnum'] ?>
                    </div>
                </div>
           
            </div>
            
             
           <div style="height: 45px;">
		   
		   
		   <?php if($rowu['is_deliv']==1){ ?>
		   
                <button tapmode="" onclick="H.openWin('wuliucxnew', 'wuliucxnew.php?id=<?php echo $row['id'] ?>');" style="float: left;">查看物流</button>
			<?php } ?>
			
		   <?php if($rowu['is_deliv']==0){ ?>
		   
                <button tapmode="" onclick="H.openWin('wuliucxnew', 'wuliucxnew.php?id=<?php echo $row['id'] ?>');" style="float: left;">暂未发货</button>
			<?php } ?>				
			                <?
                         // 是否有清关的身份证
                        $sql_qin = "select identify_pic from tbl_qinguan WHERE user_id = ".$_COOKIE['userid']." limit 1";
                        $res_qin=mysql_query($sql_qin);
						$row_reslut1=mysql_fetch_array($res_qin);
                        if($row_reslut1){
                        }else{
                              $userid = $_COOKIE['userid'];
                              echo " <button onclick=\"H.openWin('djfuqian', 'qinguan.php?fid=$userid');\" class=\"H-outline-none H-theme-background-color-transparent H-theme-border-color8 H-font-size-10 H-theme-font-color8 H-theme-background-color1-click H-theme-font-color1-click H-theme-border-color1-click H-border-radius-3 H-white-space-nowrap\">上传身份证</button>";

                        }



                ?>	
				
				<?php if($row3['goodstype']==2 && $row3['is_refund']==0){ ?>
				
			
				
				 <button  type="button" tapmode="" onclick="tuihuo('<?=$row['id']?>')">退货</button>
				
				
				
					<?php } ?>	
               <div style="float: right;">
                    <button  tapmode="" onclick="H.openWin('liaoliao', 'liaoliao.php?fid=<?php echo $row['uid'] ?>');"  >联系卖家</button>
                    <button  type="button" tapmode="" onclick="del('<?=$row['id']?>')">确认收货</button>
                </div>    
             </div>   
        </div>

              <?php } ?>

            <?php

    if($page==1){   
	if($page_count>$page){
		
	echo "<a href='?page=".$next."'  style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;'>下一页</a>&nbsp;&nbsp;&nbsp;";	
	
	}
   }else
    if($page==$page_count){
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;'>上一页</a>&nbsp;&nbsp;&nbsp;";
    }else{
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;'>上一页</a>&nbsp;&nbsp;&nbsp;";
      echo "<a href='?page=".$next."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;'>下一页</a>&nbsp;&nbsp;&nbsp;"; 
    }
  ?>  
    </div>
	<script type="text/javascript" src="/ui/xianzhi/js/jquery.min.js"></script>
    <script type="text/javascript" src="/ui/script/H.js"></script>
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>  
    
	
	  	<script>
	function del(a){
		var order_id=a;
		var uid='<?=$_COOKIE['userid']?>';
	        $.ajax({
            url:'/api/muyin/api.php?s=haigou.user_commit_receicve_fanli',
            type:'POST',
            data:{
				uid:uid,
			order_id:order_id	
			},
            success:function(data){
			    if (data.code==0) {
				
				
    layer.open({
    content: '确认收货成功!'
    ,skin: 'msg'
    ,time: 2 
  }); 
  
  

      send();
	   
				}else {
					
		    layer.open({
    content: '暂时不能收货!'
    ,skin: 'msg'
    ,time: 2 
  }); 			
					
					
				}					
            },
            error:function(){

            }
        });		
		
	}
	

	</script>
	
		<script>
	  function send(){
	  
	        $.ajax({
            url:'sendqiandao.php',
            type:'POST',
            data:{
				uid:uid,
			title:title	
			},
            success:function(data){	
    layer.open({
    content: '短信发送成功!'
    ,skin: 'msg'
    ,time: 2 
  }); 
        setTimeout(close,1100);
            },
            error:function(){

            }
        });	


	  
  }	
	
	</script>
	
	
	<script>
	  function close(){
	  
	location.reload();  
  }	
	
	</script>
	
	
	
	

	<script>
	  function tuihuo(v){

layer.open({
  content: '<div class="H-flexbox-horizontal H-margin-vertical-bottom-10">'
    + '<span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">理由:</span>'
	+' <input id="tuivalue" type="text" class="H-textbox H-vertical-align-middle H-vertical-middle'
	+ 'H-font-size-16 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" placeholder="退款理由..." />'
    +'</div>'
	+'<div class="H-padding-vertical-bottom-10"></div>'	
	+'<button onclick="tuiapi('+v+')" class="H-button H-font-size-15 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20' 
	 + ' H-theme-background-color8 H-theme-font-color-white H-theme-border-color8 H-theme-border-color8-click' 
	 + ' H-theme-background-color8-click ' 
	+'H-theme-font-color8-click H-border-radius-3">提交</button>'
	+'<button onclick="tuiapi('+v+')" class="H-button H-font-size-15 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20' 
	 + ' H-theme-background-color8 H-theme-font-color-white H-theme-border-color8 H-theme-border-color8-click' 
	 + ' H-theme-background-color8-click ' 
	+'H-theme-font-color8-click H-border-radius-3">关闭</button>'	
	,
  shadeClose: false,
});



	  
  }	
	

	
	
	
	
	</script>	
	<script>
	
		function tuiapi(r){
		var reason=document.getElementById('tuivalue').value
		var oid=r;
		var uid='<?=$_COOKIE['userid']?>';	
		console.log(oid);		
		console.log(reason);		
		console.log(uid);
		
	}
	
	
	</script>
	
</body>
</html>